let plugList = {};
plugList.navEl = $('.nav-middle');
plugList.listArr = plugList.navEl.find('.list');
// let floatAboutEl = $('.m-float-about');
// 最外层的全屏滚动层
// plugList.mSwiper = new Swiper('.m-swiper', {
//     // 设置竖屏滚动
//     direction: 'vertical',
//     simulateTouch: false,
//     mousewheelControl: true,
//     onSlideChangeStart: function (swiper) {
//         plugList.listArr.eq(swiper.activeIndex).addClass('active').siblings().removeClass('active');
//         // alert(swiper.activeIndex);
//     },
//     // 设置边缘禁止滚动
//     resistanceRatio: 0,
//     onProgress: function (swiper, progress) {
//         if (progress < 0.1666666) {
//             $('#afooter').removeClass('hide');
//         } else {
//             $('#afooter').addClass('hide');
//         }
//     },
//     watchSlidesProgress: true,
//     autoHeight: true, // 高度随内容变化
//     observer: true,
//     observeParents: true
// });
$(function () {
    $('.m-fullpage').fullpage({
        // 导航
        // lockAnchors: true,
        // anchors: ['firstPage', 'secondPage'],
        // navigation: true,
        // navigationPosition: 'right',
        // navigationTooltips: ['firstSlide', 'secondSlide'],
        normalScrollElements: '.m-float-about, .scroll-cont',
        showActiveTooltip: true,
        slidesNavigation: true,
        onLeave: function (index, nextIndex, direction) {
            // console.log(nextIndex);
            if (nextIndex <= 1) {
                $('#afooter').removeClass('hide');
            } else {
                $('#afooter').addClass('hide');
            }
            let eachNum = nextIndex - 1;
            plugList.listArr.eq(eachNum).addClass('active').siblings().removeClass('active');
            // switch (index) {
            //     case 1:
            //     plugList.listArr.eq()
            // }
        }
    });
});
// $(document).ready(function () {
//     $('.m-fullpage').fullpage();
// });
// $('#focus').movingBoxes({
//     startPanel: 1, // 从第一个li开始
//     reducedSize: 0.5, // 缩小到原图50%的尺寸
//     wrap: true, // 无缝循环
//     buildNav: true, // 显示指示器效果
//     navFormatter: function () {
//         return '&#9679;';
//     } // 指示器格式，为空即会显示123
// });
function browserType () {
    let userAgent = navigator.userAgent; // 取得浏览器的userAgent字符串
    let isOpera = userAgent.indexOf('Opera') > -1; // 判断是否Opera浏览器
    let isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1 && !isOpera; // 判断是否IE浏览器
    let reIE = new RegExp('MSIE (\\d+\\.\\d+);');
    reIE.test(userAgent);
    let fIEVersion = parseFloat(RegExp['$1']);
    if (isIE && parseInt(fIEVersion) < 11) {
        // console.log(fIEVersion);
        $('.swiper-slide').removeClass('active');
    } else {
        $('.outside-swiper').removeClass('active');
        plugList.main03Cards = new Swiper('.swiper-card', {
            initialSlide: 5,
            loop: true,
            effect: 'coverflow',
            slidesPerView: 'auto',
            centeredSlides: true,
            slideActiveClass: 'swiper-slide-active',
            coverflow: {
                rotate: 0,
                stretch: 20,
                depth: 180,
                modifier: 3,
                slideShadows: false
            },
            pagination: '.swiper-card .swiper-pagination',
            paginationClickable: true,
            prevButton: '.button-match-left',
            nextButton: '.button-match-right'
        });
        plugList.main06Years = new Swiper('.swiper-years', {
            initialSlide: 5,
            loop: true,
            effect: 'coverflow',
            slidesPerView: 'auto',
            centeredSlides: true,
            slideActiveClass: 'swiper-slide-active',
            coverflow: {
                rotate: 0,
                stretch: 26,
                depth: 260,
                modifier: 2,
                slideShadows: false
            },
            onSlideChangeStart: function (swiper) {
                // console.log(swiper.realIndex); // 切换结束时，告诉我现在是第几个slide
                $('.swiper-years .text-about').eq(swiper.realIndex).addClass('active').siblings().removeClass('active');
            },
            pagination: '.swiper-years .swiper-pagination',
            paginationClickable: true,
            prevButton: '.button-year-left',
            nextButton: '.button-year-right'
        });
    }
}
browserType();
// let isEdge = userAgent.indexOf('Windows NT 6.1; Trident/7.0;') > -1 && !isIE; // 判断是否IE的Edge浏览器
// var isFF = userAgent.indexOf("Firefox") > -1; // 判断是否Firefox浏览器
// var isSafari = userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") == -1; //判断是否Safari浏览器
// var isChrome = userAgent.indexOf("Chrome") > -1 && userAgent.indexOf("Safari") > -1; //判断Chrome浏览器

plugList.navEl.on('click', '.list', function () {
    if ($('.m-float-about').hasClass('show')) {
        $('.m-float-about').removeClass('show');
    }
    let index = $(this).index() + 1;
    // console.log(index);
    $.fn.fullpage.moveTo(index);
});
// 添加滚动条
$('.slide07 .box').mCustomScrollbar({
    theme: 'my-theme'
});
$('.m-float-about .about-scroll').mCustomScrollbar({
    theme: 'my-theme'
});
$('.ip-page .scroll-main').mCustomScrollbar({
    theme: 'my-theme'
});
module.exports = plugList;
